home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / qbfaqr01.zip / PAGER.BAS < prev    next >
BASIC Source File  |  1992-08-10  |  1KB  |  56 lines

  1. 'File: PAGER
  2. 'Date: 2/1/92
  3. 'Written By: Luis Espinoza
  4. 'Description: Pager is a simple program that will slice a text file
  5. 'into separate smaller files. Generally used for slicing large text
  6. 'or source files (hint, hint) to be posted on BBS.
  7. '
  8. 'PAGER command line:
  9. ' PAGER filename nn
  10. '
  11. ' filename - text file to work on
  12. ' nn       - number of output lines per file
  13. '
  14.   PRINT "     PAGER"
  15.   PRINT "Copyright 1992"
  16.   PRINT "Micro Miracles"
  17.   PRINT "--------------"
  18.   sp = INSTR(COMMAND$, " ") + 1
  19.   fi$ = LEFT$(COMMAND$, sp)
  20.   lin = VAL(MID$(COMMAND$, sp))
  21.   IF DIR$(fi$) = "" THEN
  22.      PRINT "usage:"
  23.      PRINT "PAGER filename nn"
  24.      PRINT
  25.      PRINT "Pager creates smaller files of text files."
  26.      PRINT "It takes a text file and slices it to nn lines per file"
  27.      PRINT "all files are numberd filename.xxx where xxx is between"ì     PRINT
  28.      END
  29.   END IF
  30.   fi = 0
  31.   lc = 0
  32.   nf$ = LEFT$(fi$, INSTR(fi$, ".") - 1)
  33.   OPEN fi$ FOR INPUT AS #1
  34.   ON ERROR GOTO doneread
  35.   WHILE NOT EOF(1)
  36.     LINE INPUT #1, a$
  37.     IF lc = 0 THEN
  38.        e$ = MID$(STR$(fi), 2)
  39.        DO WHILE LEN(e$) < 3
  40.          e$ = "0" + e$
  41.        LOOP
  42.        OPEN nf$ + "." + e$ FOR OUTPUT AS #2
  43.        fi = fi + 1
  44.     END IF
  45.     PRINT #2, a$
  46.     lc = lc + 1
  47.     IF lc = lin THEN
  48.       CLOSE #2
  49.       lc = 0
  50.     END IF
  51.   WEND
  52. doneread:
  53.   CLOSE
  54.   fi = fi - 1
  55.   PRINT fi; "Files created"
  56.